package com.gsafety.wellsfort.common.context;

/**
 * @author tangjiawei
 * @date 2020/04/15
 */
public class ContextHolder {
    private static final ThreadLocal<LoginContext> threadLocal = new ThreadLocal<>();

    public static void setContext(LoginContext context) {
        threadLocal.set(context);
    }

    public static LoginContext getContext() {
        if (threadLocal.get() == null) {
            threadLocal.set(new LoginContext());
        }
        return threadLocal.get();
    }

    public static void remove() {
        threadLocal.remove();
    }
}
